<!--
 * @Author: your name
 * @Date: 2022-03-31 17:51:06
 * @LastEditTime: 2022-03-31 17:52:55
 * @LastEditors: your name
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \geyao\geyao\深拷贝实现方式1220331.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>深拷贝实现方式1</title>
</head>

<body>
  <script>
    let arr = [1, 3, {
      username: ' 歌谣'
    }];
    let arr4 = JSON.parse(JSON.stringify(arr));
    arr4[2].username = '方方';
    console.log(arr, arr4)
    //获取的值不同 开辟新的内存   这种方法虽然可以实现数组或对象深拷贝,但不能处理函数和正则
  </script>
</body>

</html>